package com.im.common.util;

/**
 * 工具类
 *
 * @author yunZhouJiaDi
 */
public class StringTool {

    public static boolean isChinese(String input) {
        for (char c : input.toCharArray()) {
            if (c >= '\u4E00' && c <= '\u9FA5') {
                return true;
            }
        }
        return false;
    }

    public static boolean isEmpty(String str) {
        if (null == str || "".equals(str) || "null".equals(str) || "\u0000".equals(str)) {
            return true;
        } else if ("".equals(str.trim())) {
            return true;
        }
        return false;
    }

    public static String escape(String content) {
        if (isEmpty(content)) {
            return content;
        }
        content = content.replace("<", "&lt;");
        content = content.replace("\r\n", "<br>");
        content = content.replace("\n", "<br>");
        return content;
    }

}
